<%-- 
    Document   : patient
    Created on : Dec 20, 2011, 10:44:45 AM
    Author     : administrator
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

<!-- RichFaces tag library declaration -->
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dt>

<!DOCTYPE html>
<f:view locale="#{languagesBean.locale}">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title><h:outputText value="#{lang.patientTitle}" /></title>
        </head>
        <body>
            <jsp:include page="/pages/header.jsp"/>
            <rich:tabPanel id="mainPatient" style="margin-left:auto; margin-right:auto;" width="80%" headerAlignment="right">
                <rich:tab id="change" label="#{lang.patientTabEdit}" action="#{user.flushMessages()}">
                    <rich:panel id="changePanel" header="#{lang.patientTabEdit}">
                    <p>
                        <a4j:form>
                            <h:outputText value="#{lang.patientChangeEmail}" style="font-weight:bold; font-size:14px;"/><BR>
                            <h:outputText value="#{lang.patientEnterEmail}" /><BR>
                            <h:inputText value="#{user.email}"/><BR>
                            <h:outputText value="#{lang.patientConfirm}"/><BR>
                            <h:inputText value="#{user.confirmEmail}"/><BR>
                            <h:outputText id="msgEmail" value="#{lang.patientBadEmail}" rendered="#{user.isErrorEmail()}" style="color:red;"/><BR>
                            <a4j:commandButton value="#{lang.patientChangeEmail}" action="#{user.changeEmail()}" reRender="changePanel"/>
                        </a4j:form>
                    </p>
                    <p>
                        <a4j:form>
                            <h:outputText value="#{lang.patientChangePassword}" style="font-weight:bold; font-size:14px;"/><BR>
                            <h:outputText value="#{lang.patientEnterPassword}" /><BR>
                            <h:inputSecret value="#{user.password}"/><BR>
                            <h:outputText value="#{lang.patientConfirm}"/><BR>
                            <h:inputSecret value="#{user.confirmPassword}"/><BR>
                            <h:outputText id="msgPassword" value="#{lang.patientBadPassword}" rendered="#{user.isErrorPassword()}" style="color:red;"/><BR>
                            <a4j:commandButton value="#{lang.patientChangePassword}" action="#{user.changePassword()}" reRender="changePanel"/>
                            
                        </a4j:form>
                    </p>
                    </rich:panel>
                </rich:tab>                
                
                <rich:tab id="profile" label="#{lang.patientTabProf}" action="#{patient.loadMyProfile()}">
                    <f:setPropertyActionListener target="#{patient.id}" value="#{user.id}"/>

                    <p>
                        <h:graphicImage value="#{patient.picture}" width="150" height="150"/>
                    </p>
                    
                    <p>
                        <h:outputText value="#{lang.profileName} / #{lang.profileSurname}: " style="font-weight:bold;"/>
                        <h:outputText value="#{patient.name} #{patient.surname}" />
                            <BR>
                        <h:outputText value="#{lang.profileID}: " style="font-weight:bold;"/>
                        <h:outputText value="#{patient.id}"/>
                    </p>
                    <p>
                        <h:outputText value="#{lang.profileGender}: " style="font-weight:bold;"/>
                        <h:outputText value="#{patient.gender}"/>
                    </p>
                    <p>
                        <h:outputText value="#{lang.profileBirthDate}: " style="font-weight:bold;"/>
                        <h:outputText value="#{patient.birthplace} , #{patient.birthdate}"/>                        
                    </p>
                    <p>
                        <h:outputText value="#{lang.profileAddress}: " style="font-weight:bold;"/>
                        <h:outputText value="#{patient.address}, #{patient.cap}"/>
                    </p>
                    <p>
                        <h:outputText value="#{lang.profileChiefTain}: " style="font-weight:bold;"/>
                        <h:outputText value="#{patient.chiefTainId}"/>
                    </p>
                    <p>
                        <h:outputText value="#{lang.profileContact}" style="font-weight:bold;"/><BR>
                        <h:outputText value="#{lang.profileCell}: " style="font-weight:bold;"/>
                        <h:outputText value="#{patient.phone}"/><BR>
                        <h:outputText value="#{lang.profileEmail}: " style="font-weight:bold;"/>
                        <h:outputText value="#{patient.email}"/>
                    </p>
                </rich:tab>
                
                    <rich:tab id="future" label="#{lang.patientTabVis}" action="#{patient.loadMyFutureVisits()}">
                    <f:setPropertyActionListener target="#{patient.id}" value="#{user.id}"/>
                    <%-- Visite future--%>
                    <a4j:form>
                        <rich:dataTable  value="#{patient.myVisits}" var="patVis" width="100%" rows="5">
                            
                            <f:facet name="caption">
                                <h:outputText value="#{lang.profileVisFutureCaption}" />
                            </f:facet>
                            
                            <rich:column>
                                <f:facet name="header">
                                    <h:outputText value="#{lang.profileVisId}"/>
                                </f:facet>
                                <h:outputText value="#{patVis.visit_id}"/>
                            </rich:column>
                            
                            <rich:column>
                                <f:facet name="header">
                                    <h:outputText value="#{lang.profileVisUrg}" />
                                </f:facet>
                                <h:graphicImage value="#{patVis.urgencyImg()}" width="50" height="50"/>
                            </rich:column>
                            
                            <rich:column sortBy="#{patVis.date}">
                                <f:facet name="header">
                                    <h:outputText value="#{lang.profileVisDate}"/>
                                </f:facet>
                                <h:outputText value="#{patVis.date}"/>
                            </rich:column>
                            
                            <rich:column>
                                <f:facet name="header">
                                    <h:outputText value="#{lang.profileVisMed}"/>
                                </f:facet>
                                <h:outputText value="#{patVis.doctor_name}"/>
                            </rich:column>
                            
                            <rich:column>
                                <f:facet name="header">
                                    <h:outputText value="#{lang.profileVisRep}"/>
                                </f:facet>
                                <h:outputText value="#{patVis.report}"/>
                            </rich:column>
                            
                            <f:facet name="footer">
                                <rich:datascroller id="scroller" ></rich:datascroller>
                            </f:facet>
                            
                        </rich:dataTable>
                    </a4j:form>
                    
                </rich:tab>
                    
                    <rich:tab id="first" label="#{lang.patientTabFirst}" action="#{patient.loadFirstVisits()}">
                    <f:setPropertyActionListener target="#{patient.id}" value="#{user.id}"/>
                    <%-- Visite future--%>
                    <a4j:form>
                        <rich:dataTable  value="#{patient.myVisits}" var="patVis" width="100%" rows="5">
                            
                            <f:facet name="caption">
                                <h:outputText value="#{lang.profileVisFutureCaption}" />
                            </f:facet>
                            
                            <rich:column>
                                <f:facet name="header">
                                    <h:outputText value="#{lang.profileVisId}"/>
                                </f:facet>
                                <h:outputText value="#{patVis.visit_id}"/>
                            </rich:column>
                            
                            <rich:column>
                                <f:facet name="header">
                                    <h:outputText value="#{lang.profileVisUrg}" />
                                </f:facet>
                                <h:graphicImage value="#{patVis.urgencyImg()}" width="50" height="50"/>
                            </rich:column>
                            
                            <rich:column sortBy="#{patVis.date}">
                                <f:facet name="header">
                                    <h:outputText value="#{lang.profileVisDate}"/>
                                </f:facet>
                                <h:outputText value="#{patVis.date}"/>
                            </rich:column>
                            
                            <rich:column>
                                <f:facet name="header">
                                    <h:outputText value="#{lang.profileVisMed}"/>
                                </f:facet>
                                <h:outputText value="#{patVis.doctor_name}"/>
                            </rich:column>
                            
                            <rich:column>
                                <f:facet name="header">
                                    <h:outputText value="#{lang.profileVisRep}"/>
                                </f:facet>
                                <h:outputText value="#{patVis.report}"/>
                            </rich:column>
                            
                            <f:facet name="footer">
                                <rich:datascroller id="scroller" ></rich:datascroller>
                            </f:facet>
                            
                        </rich:dataTable>
                    </a4j:form>
                    
                </rich:tab>
                
                
                <rich:tab id="hystory" label="#{lang.patientTabHys}"  action="#{patient.loadMyPastVisits()}">
                    <f:setPropertyActionListener target="#{patient.id}" value="#{user.id}"/>
                    <%-- Anamnesi --%>
                    <a4j:form>
                        <rich:dataTable  value="#{patient.myVisits}" width="100%" var="patVis" rows="5">
                            
                            <f:facet name="caption">
                                <h:outputText value="#{lang.profileVisPastCaption}" />
                            </f:facet>
                            
                            <rich:column>
                                <f:facet name="header">
                                    <h:outputText value="#{lang.profileVisId}"/>
                                </f:facet>
                                <h:outputText value="#{patVis.visit_id}"/>
                            </rich:column>
                            
                            <rich:column sortBy="#{patVis.date}">
                                <f:facet name="header">
                                    <h:outputText value="#{lang.profileVisDate}"/>
                                </f:facet>
                                <h:outputText value="#{patVis.date}"/>
                            </rich:column>
                            
                            <rich:column>
                                <f:facet name="header">
                                    <h:outputText value="#{lang.profileVisMed}"/>
                                </f:facet>
                                <h:outputText value="#{patVis.doctor_name}"/>
                            </rich:column>
                            
                            <f:facet name="footer">
                                <rich:datascroller id="scroller" ></rich:datascroller>
                            </f:facet>
                            
                        </rich:dataTable>
                    </a4j:form>
                </rich:tab>
                
            </rich:tabPanel>
        </body>
    </html>
</f:view>